package com.itnoob.status;

/**
 * 枚举值
 * @author zhoujun
 * @date 2025/3/20 20:42
 */
public enum OrderStatusEnum {
    CREATED("CREATED"),
    PAID("PAID"),
    DELIVERED("DELIVERED"),
    RECEIVED("RECEIVED"),
    CANCELED("CANCELED"),
    CLOSED("CLOSED");
    private String code;

    OrderStatusEnum(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public static  OrderStatusEnum fromString(String code){
        OrderStatusEnum[] values = OrderStatusEnum.values();
        for (OrderStatusEnum value : values) {
            if (value.code.equals(code)){
                return value;
            }
        }
        throw new IllegalArgumentException("没有这个枚举值");
    }
}
